package com.feicheng.iou.oss.util;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;

/**
 * @Author tianchunlei
 * @Des //获取oss存储时配置文件相关参数类并封装常量
 * @Date 2021/8/17
 **/
@Component
@PropertySource(value = "classpath:oss.properties",encoding = "UTF-8")
public class ConstantOSSPropertiesUtils implements InitializingBean{

    //服务器地址
    @Value("${aliyun.oss.accessKeyId}")
    private String accessKeyId;

    //阿里云中accessKeyId
    @Value("${aliyun.oss.secret}")
    private String secret;

    //阿里云中secret
    @Value("${aliyun.oss.bucketName}")
    private String bucketName;

    @Value("${aliyun.oss.endPoint}")
    private String endPoint;



    public static  String ACCESS_KEY_ID;
    public static  String SECRET;
    public static  String BUCEKT_NAME;
    public static  String END_POINT;


    @Override
    public void afterPropertiesSet() throws Exception {
        ACCESS_KEY_ID = accessKeyId;
        SECRET = secret;
        BUCEKT_NAME = bucketName;
        END_POINT = endPoint;
    }
}
